#!/bin/bash
#cat url | awk  -F '/' '{print $1}' | awk '!a[$0]++' >dsname
#cat url | echo ${0#*//} | awk '!a[0]++' >dsnamem
#cat url | awk '!a[$0]++' >dsname
h="+"
#for line in `cat dsname`
echo "domain"$h"cname"$h"A">/root/dns.txt
cat dsname | while read line
do
echo $line
cname=`dig $line A | grep -v ';' | grep A |grep CNAME | awk '{print $5}'`
a=`dig $line  A | grep -v ';' | grep A | grep -v CNAME | awk '{print $5}'`
#mx=`dig $line MX | grep -v ';' | grep MX | awk '{print $6}'`
#ns=`dig $line NS | grep -v ';' | grep NS | awk '{print $5}'`
#echo $line$h$a$h$mx$h$ns >>/root/dns.txt
echo $line$h$cname$h$a >>./dns.txt
done
